package com.steak.minio.configuration;

import com.steak.minio.properties.MinioProperties;
import io.minio.MinioClient;
import lombok.Data;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 小四哥
 * @date 2022-04-1614:39
 */
@Data
@Configuration
public class MinIoClientConfiguration {

    final MinioProperties minIoProperties;

    @Bean
    public MinioClient minioClient(){
        return MinioClient.builder()
                .endpoint(minIoProperties.getEndpoint())
                .credentials(minIoProperties.getAccessKey(), minIoProperties.getSecretKey())
                .build();
    }
}
